<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AddCofigDataDesc extends Migrator
{
    private $data = [
        [
            'name' => 'company_desc',
            'title' => '公司简介',
            'type' => 'text',
            'create_time' => '1597851031',
            'value' => '公司简介',
        ],
        [
            'name' => 'setting_email',
            'title' => '招聘设置-邮件申请',
            'type' => 'text',
            'create_time' => '1597851031',
            'value' => '招聘设置-邮件申请',
        ],
        [
            'name' => 'setting_tel',
            'title' => '招聘设置-电话申请',
            'type' => 'text',
            'create_time' => '1597851031',
            'value' => '招聘设置-电话申请',
        ],
    ];
    public function up()
    {
        foreach ($this->data as $item){
            Db::name('config')->insert($item);
        }

    }
    public function down()
    {
        foreach ($this->data as $item){
            Db::name('config')->where('name', '=', $item['name'])->delete();
        }
    }
}
